﻿using System;
using System.Collections.Generic;
using System.Text;

namespace task3
{
    class Sieve
    {

        static void Main(string[] args)
        {
            //创造一个数组包含100以内的数
            int[] num = new int[101];
            int a = 2;
            int i = 0;
            while (a <= 100)
            {
                num[i] = a;
                a++;
                i++;
            }

            //开始筛选
            for (int b = 2; b <= 100; b++)
            {
                for (int index = 0; index <= 100; index++)
                {
                    if (num[index] % b == 0 && num[index] / b != 1)
                    {
                        num[index] = 1;//原数组没有1，用1替换达到剔除的效果
                    }
                }
            }

            foreach (int x in num)
            {
                if (x != 1)
                {
                    Console.WriteLine(x);
                }
            }


        }
    }
}

